//Created by CodeGenerator 20060122#qq.com on 2019-03-11 14:25:27
package router

import (
	"gitee.com/godY/daminghu-cli-server/api"
	"gitee.com/godY/daminghu-cli-server/common"
	"github.com/astaxie/beego"
)

func Cfg() {

	ns := beego.NewNamespace(common.PREFIX_URL,
		//此处正式版时改为验证加密请求
		//beego.NSCond(func(ctx *context.Context) bool {
		//	logs.Info("UserAgent", ctx.Request.UserAgent())
		//	logs.Info("Host", ctx.Request.Host)
		//	//if ctx.Request.Host != "localhost:12345" {
		//	//	return false
		//	//}
		//	//if ua := ctx.Input.Request.UserAgent(); ua != "" {
		//	//	return true
		//	//}
		//	//return false
		//	return true
		//}),

		beego.NSRouter("/readlogin", &api.LOGIN_CONTROLLER{}, "post:ReadLogin"),

		beego.NSNamespace("/create",

			beego.NSRouter("/", &api.CREATE_CONTROLLER{}, "*:Create"),
			beego.NSRouter("/all", &api.CREATE_CONTROLLER{}, "post:CreateAll"),
			beego.NSRouter("/server", &api.CREATE_CONTROLLER{}, "get:CreateServer"),
			beego.NSRouter("/web", &api.CREATE_CONTROLLER{}, "get:CreateWeb")),
	)

	beego.AddNamespace(ns)

}
